sc.vec2
The Vector3 Module for the computer API!
Functions
new
sc.vec2.new( x, y )
Creates a new 2D vector with specified x and y values.
Arguments:
- x [ number ] The X value of the vector.
- y [ number ] The Y value of the vector.
Returns:
- [ Vector2 ] A new vector2 instance.
convertIfNeeded
sc.vec2.convertIfNeeded( input, nilAllowed )
Converts an input into a Vector2 if needed. If the input is already a Vector2, it returns it; otherwise, it tries to convert from a table.
Arguments:
- input [ ScVec2|table ] The input that might be a Vector2 or a table representing it.
- nilAllowed [ boolean ] Whether
nilis allowed as a valid input.
Returns: